package demo;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
  @WebServlet('/LoginServlet')
public class LoginServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        ServletContext context =  super.getServletContext();
        String param = getServletContext().getInitParameter('');
        System.out.println(param);
        String host = req.getQueryString();
        int port = req.getServerPort();
        StringBuffer url = req.getRequestURL();
        String uri = req.getRequestURI();
        String protocol = req.getProtocol();

        PrintWriter writer = resp.getWriter();
        writer.println(host + "" + port + "" + url + "" + protocol);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        super.doPost(req, resp);
    }
}
